/**
 * @MediatorMetadata.as
 * 
 * @author sodaChen mail:asframe@163.com
 * @version 1.0
 * <br>Copyright (C), 2012 ASFrame.com
 * <br>This program is protected by copyright laws.
 * <br>Program Name:ASFrame AStruts2
 * <br>Date:2012-5-5
 */
package com.asframe.astruts2.metadata
{
	import com.asframe.astruts2.Astruts2Const;
	import com.asframe.astruts2.context.IAStrutsContext;
	import com.asframe.pattern.observer.ISubjects;
	import com.asframe.ref.Metadata;
	import com.asframe.ref.Method;
	import com.asframe.ref.Type;

	/**
	 * Mediator的标签解析, 主要是解析mediator的感兴趣事件以及被调用的方法
	 * @author sodaChen
	 * @Date:2012-5-5
	 */
	public class MediatorMetadata
	{
		public function MediatorMetadata()
		{
		}
		public function parseMediator(mediator:Object,mediatorType:Type,subjects:ISubjects,context:IAStrutsContext):void
		{
			//这里不需要注入变量.但是还需要查找其他的注入对象
			var notcie:String = null;
			var metadata:Metadata = null;
			//方法
			for each (var methed:Method in mediatorType.methods) 
			{
				metadata = methed.getMetadata(Astruts2Const.NOTICE_METADATA);
				if(metadata != null)
				{
					//把当前方法设置为感兴趣通知
					notcie = methed.name;
					if(metadata.args != null && metadata.args.length > 0)
					{
						notcie = notcie[0].value;
					}
					//这里需要根据Mediator的类型，以及是否观察者，是否一次性等等
				}
			}
		}
	}
}
